import { Rules } from "../validate";
interface Populate {
  path?: string;
  select?: string;
  populate?: any;
}
export interface IndexCondition {
  pageIndex?: number; // 当前页
  pageSize?: number; // 每页的个数
  select?: string | string[]; // 需要显示的字段
  populate?: Array<Populate | string>; // 连表
  customSort?: Record<string, any>; // 排序字段
  find?: Record<string, any>; // 查询条件
}
export const defaultIndexCondition: Required<IndexCondition> = {
  pageIndex: 0,
  pageSize: 10,
  select: "",
  populate: [],
  customSort: { createdAt: -1 },
  find: {},
};

export interface CreateRule {
  [key: string]: Rules;
}
